#include <iostream>
#include <array>
#include <numeric>

#include "fmt/format.h"
using namespace std;

int myMulti(int x, int y) {
    return x * y + 1;
}
int main() {
    constexpr std::array integers{ 1,4,7,9 };
    {
        int sum = std::accumulate(integers.begin(), integers.end(), 0);
        cout << fmt::format("total sum of integers is: {}\n", sum);
    }

    {
        int result = std::accumulate(integers.begin(), integers.end(), 1, std::multiplies<int>());
        cout << fmt::format("total multi of integers is: {}\n", result);
    }

    {
        int result = std::accumulate(integers.begin(), integers.end(), 1, myMulti);
        cout << fmt::format("total multi+1 of integers is: {}\n", result);
    }

    {
        int result = std::accumulate(integers.begin(), integers.end(), 1, [](const auto& x, const auto& y) {return x + y + 10;});
        cout << fmt::format("total +10 of integers is: {}\n", result);
    }
    return 0;
}